home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
G-Games
/
(c)gb.d64
/
twin bagels.c
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2007-02-04
|
3KB
|
100 lines
3 REM *********************************
4 REM * MODIFIED SLIGHTLY AT 0223H ON *
5 REM * APRIL THE 5TH, 1985 BY *
6 REM * DAVID BRADLEY *
7 REM *********************************
90 POKE53280,6:POKE53281,14:PRINT"[144]"
100 PRINT"[147] BAGELS JIM BUTTERFIELD"
110 INPUT"WANT INSTRUCTIONS";Z$:IFASC(Z$)=78GOTO280
120 PRINT"A GUESSING GAME BASED ON SECRET CODES:"
130 PRINT" YOU THINK UP A SECRET CODE OF"
140 PRINT" 4 LETTERS, EACH A[146] TO F[146]..."
150 PRINT" ..AND I'LL THINK OF ONE, TOO"
160 PRINT"WE EACH TAKE TURNS GUESSING THE OTHER'S"
170 PRINT"CODE. ON EACH GUESS WE'LL BE TOLD:"
180 PRINT" --EXACT MATCHES; GUESSING THE RIGHT"
190 PRINT" LETTER IN THE RIGHT PLACE;
200 [153]" --OTHER MATCHES; THE RIGHT LETTER,"
210 [153]" BUT IN THE WRONG PLACE.
220 PRINT"COUNT CAREFULLY, AND DON'T FORGET TO"
230 PRINT"ALLOW FOR DUPLICATE LETTERS:"
240 PRINT" E.G., IF MY SECRET CODE IS 'FAFD'AND"
250 PRINT" YOU GUESS 'FADE', YOU'LL GET"
260 PRINT" 2 EXACT (THE F AND THE A)"
270 PRINT" 1 MATCH (THE D)."
280 DIMC$(6),M(4,10),R(2,10),T(4),Z(1,4),G(4),S(4)
290 J=RND(-TI)
300 FORJ=1TO4:T(J)=1:S(J)=INT(RND(1)*6+1):NEXT
310 INPUT"HAVE YOU THOUGHT OF A SECRET CODE";Z$
320 FORJ=1TO6:C$(J)=CHR$(J+64):NEXT
330 FORJ=1TO6:K=INT(RND(1)*6)+1:C$=C$(J):C$(J)=C$(K):C$(K)=C$:NEXTJ
340 PRINT"[147]----- YOUR ------- --- MY -----"
350 PRINT"GUESS EXACT MATCH GUESS EXA MAT"
360 FORJ=1TO10
370 FORJ1=1TO4:PRINT"[166][157]";
380 GETZ$:IFZ$=""GOTO380
390 Z=ASC(Z$):IFZ<65ORZ>70GOTO380
400 PRINTZ$;:G(J1)=Z-64:NEXTJ1
410 G1=0:FORJ1=1TO4:Z(0,J1)=0:Z(1,J1)=-1:IFG(J1)=S(J1)THENG1=G1+1:GOTO430
420 Z(0,J1)=G(J1):Z(1,J1)=S(J1)
430 NEXTJ1:PRINT" ";G1;:IFG1=4THENPRINT:GOTO770
440 G1=0:FORJ1=1TO4:FORK1=1TO4
450 IFZ(0,J1)=Z(1,K1)THENZ(0,J1)=.1:Z(1,K1)=.2:G1=G1+1
460 NEXTK1,J1:PRINT" ";G1;"";TAB(23);
470 IFJ=1THENFORK=1TO4:M(K,J)=K-1:NEXTK:M(1,1)=1:GOTO640
480 FORJ1=J-1TO1STEP-1
490 G1=R(1,J1):G2=0
500 FORK1=1TO4
510 IFT(K1)=M(K1,J1)THENG2=G2+1:IFG2>G1GOTO 730
520 NEXTK1:K1=K1-1:IFG2<>G1GOTO 730
530 NEXTJ1
540 FORJ1=J-1TO1STEP-1
550 G1=R(2,J1)
560 FORX=1TO4
570 Z(0,X)=0:Z(1,X)=-1:IFT(X)<>M(X,J1)THENZ(0,X)=T(X):Z(1,X)=M(X,J1)
580 NEXTX
590 G2=0:FORX=1TO4:FORY=1TO4:IFZ(0,X)<>Z(1,Y)GOTO620
600 G2=G2+1:IFG2>G1GOTO 730
610 Z(0,X)=.5:Z(1,Y)=.9
620 NEXTY,X:IFG1<>G2GOTO 730
630 NEXTJ1:FORX=1TO4:M(X,J)=T(X):NEXT
640 FORK=1TO4:PRINTC$(M(K,J));:NEXTK:PRINT"[146] [166][157]";
650 GETZ$:IFZ$=""GOTO650
660 Z=ASC(Z$):IFZ<48ORZ>52GOTO650
670 R(2,J)=0:R(1,J)=Z-48:PRINTZ$;" [166][157]";:IFR(1,J)=4GOTO970
680 IFR(1,J)=3THENGOTO710
690 GETZ$:IFZ$=""GOTO690
700 Z=ASC(Z$):R(2,J)=Z-48:IFZ<48ORZ>52GOTO690
710 PRINTCHR$(R(2,J)+48)
720 NEXTJ
730 IFK1<>4THENFORK2=K1+1TO4:T(K2)=1:NEXTK2
740 T(K1)=T(K1)+1:IFT(K1)>6THENT(K1)=1:K1=K1-1:PRINTCHR$(K1+58);"[157]";:GOTO 740
750 IFK1<>0GOTO480
760 PRINT:PRINT"I GIVE UP! ";
770 INPUT"WHAT WAS YOUR CODE";Z$
780 IFLEN(Z$)<>4THENZ$=Z$+" ISN'T 4 CHARACTERS!":GOTO 960
790 FORJ1=1TO4:X$=MID$(Z$,J1,1):FORK=1TO6:IFX$=C$(K)GOTO 810
800 NEXTK:Z$=X$+" ISN'T A LEGAL LETTER!":GOTO 960
810 T(J1)=K:NEXTJ1
820 FORJ1=1TOJ-1
830 G1=0:G2=0:FORK=1TO4
840 Z(0,K)=0:Z(1,K)=-1:IFT(K)=M(K,J1)THENG1=G1+1:GOTO 860
850 Z(0,K)=T(K):Z(1,K)=M(K,J1)
860 NEXTK:FORK=1TO4:FORX=1TO4:IFZ(0,K)=Z(1,X)THENG2=G2+1:Z(0,K)=0:Z(1,X)=-1
870 NEXTX,K
880 IFG1<>R(1,J1)ORG2<>R(2,J1)GOTO 900
890 NEXTJ1:GOTO1020
900 PRINT" JUST A DARNED MINUTE! "
910 PRINT"ON GUESS #";J1;"YOU SAID THAT MY"
920 PRINT"'";:FORK=1TO4:PRINTC$(M(K,J1));:NEXTK
930 PRINT"' COUNTED";R(1,J1);"AND";R(2,J1)
940 PRINT"I GET";G1;"[157] AND";G2
950 GOTO 990
960 PRINT"HEY--";Z$:GOTO 990
970 PRINT "HOORAY!"
980 PRINT"MY CODE WAS '";:FORJ=1TO4:PRINTCHR$(S(J)+64);:NEXTJ:PRINT"'"
990 INPUT"ANOTHER ONE";Z$
1000 IFASC(Z$)<>78GOTO300
1010 END
1020 PRINT"*** YOU WIN THIS ONE ***":GOTO990